#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <cstring>
using namespace std;
const int MAXN=1e6+7;
int n,m,q;
inline int ID(int x, int y) {
	return (x-1)*m+y-1;
}
struct node {
	int x,y;
	bool operator< (const node& a ) const {
		if (x!=a.x) return x<a.x;
		else return y<a.y;
	}
	node (int a, int b) {
		x=a; y=b;
	}
	node() {};
};
struct quest{
	node st, en;
	quest(node a, node b) {
		st=a; en=b;
	}
};
int ANS;
int Chaji[MAXN];
int cnt[MAXN];
void Unit(int a, int b) {
	int T=a;
	while (Chaji[T]!=T) T=Chaji[T];
	int T2=b;
	while (Chaji[T2]!=T2) {
		int tmp=T2;
		T2=Chaji[T2];
		Chaji[tmp]=T;
	}
	if (T!=T2) ANS--;
	Chaji[T2]=T; 
}
void Init() {
	for (int i=0; i<MAXN; ++i) Chaji[i]=i;
	memset(cnt, 0, sizeof(cnt));
}
int Row[]={1,0,-1,0};
int Col[]={0,-1,0,1};
inline bool check(int x, int y) {
	return x>0 && x<=n && y>0 && y<=m;
}
void Search_Unit(int x, int y) {
	int x1,y1;
	int h=ID(x,y);
	for (int i=0; i<4; ++i) {
		x1=x+Row[i]; y1=y+Col[i];
		if (!check(x1,y1)) continue;
		int t=cnt[ID(x1,y1)];
		if (!t) Unit(h, ID(x1,y1));
	}
}
int main() { 
	#ifdef hai
	freopen("in.txt", "r", stdin);
	#endif
	cin.sync_with_stdio(false);
	Init();
	cin>>n>>m>>q;
	int x1,y1,x2,y2;
	stack<quest> Quest;
	stack<int> Result;
	node st,en;
	ANS=n*m;
	int T=q;
	while (T--) {
		cin>>x1>>y1>>x2>>y2;
		st=node(x1,y1);
		en=node(x2,y2);
		if (!(st<en)) swap(st, en);
		if (st.x==en.x) {
			int h=st.x;
			for (int i=st.y; i<=en.y; ++i) {
				int &tmp=cnt[ID(h, i)];
				if (tmp==0) --ANS;
				++tmp;
			}
		}
		else {
			int h=st.y;
			for (int i=st.x; i<=en.x; ++i) {
				int &tmp=cnt[ID(i, h)];
				if (tmp==0) --ANS;
				++tmp;
			}
		}
		Quest.push(quest(st, en));
	}
	for (int i=1; i<=n; ++i) {
		for (int j=1; j<=m; ++j) {
			if (cnt[ID(i,j)]==0) {
				Search_Unit(i,j);
			}
		}
	}
	T=q;
	while (T--) {
		Result.push(ANS);
		st=Quest.top().st; en=Quest.top().en;
		Quest.pop();
		if (st.x==en.x) {
			int tmp=st.x;
			for (int i=st.y; i<=en.y; ++i) --cnt[ID(tmp,i)];
		}
		else {
			int tmp=st.y;
			for (int i=st.x; i<=en.x; ++i) --cnt[ID(i,tmp)];
		}
		if (st.x==en.x) {
			int tmp=st.x;
			for (int i=st.y; i<=en.y; ++i) 
				if (cnt[ID(tmp,i)]==0) {
					++ANS;
					Search_Unit(tmp, i);
				}
		}
		else {
			int tmp=st.y;
			for (int i=st.x; i<=en.x; ++i) 
				if (cnt[ID(i, tmp)]==0) {
					++ANS;
					Search_Unit(i,tmp);
				}
		}
	}
	while (!Result.empty()) {
		cout<<Result.top()<<endl;
		Result.pop();
	}
	return 0;
} 
